﻿using System;
using System.Collections.Generic;
using System.Text;
using ProtoBuf;

namespace Eb
{
    //-------------------------------------------------------------------------
    public enum _eUCenterNodeType : byte
    {
        Client = 1,
        UCenter = 255,
    }

    //-------------------------------------------------------------------------
    //public enum _eUCenterEtType : ushort
    //{
    //    EtUCenter = 1,
    //    EtChannelUCenter,
    //    EtChannelProject,
    //    EtChannelService,
    //    EtUCenterSession,
    //}

    //-------------------------------------------------------------------------
    public enum _eUCenterMethodType : ushort
    {
        // Node Method
        login2clientInit = 2000,
        login2clientOnLogin,
        client2loginLogin,
        client2loginHeartbeat,

        login2projectLogin,
        project2loginOnLogin,
    }

    //-------------------------------------------------------------------------
    public enum _eUCenterZkNodeName
    {
        ProjectInfo = 0,
    }

    //-------------------------------------------------------------------------
    // 登陆错误状态.
    public enum eLoginResult : byte
    {
        success = 0,            // 登录成功
        loginstatus,            // 登录状态
        accountNotExists,       // 账号不存在
        wrongPassword,          // 密码错误
        disconnected,           // 玩家连接丢失
        accountOnline,          // 账号在线
        accountLocked,          // 帐号被锁定
        timeOut,                // 服务端超时
        serverReject,           // 服务端拒绝
        connectFailed,           // 连接服务端失败
        unknow,                 // 未知错误
    }

    //-------------------------------------------------------------------------
    [ProtoContract]
    public struct LoginData
    {
        [ProtoMember(1)]
        public string token;// 登陆id，guid
        [ProtoMember(2)]
        public ulong acc_id;
        [ProtoMember(3)]
        public string acc;
        [ProtoMember(4)]
        public string pwd;
        [ProtoMember(5)]
        public Dictionary<string, string> map_param;
        [ProtoMember(6)]
        public string ucenter_mq;
        [ProtoMember(7)]
        public string service_mq;
        [ProtoMember(8)]
        public bool service_result;
    }

    //-------------------------------------------------------------------------
    [ProtoContract]
    public class ClientLoginRequest
    {
        [ProtoMember(1)]
        public string acc;
        [ProtoMember(2)]
        public string pwd;
        [ProtoMember(3)]
        public string project_name;
        [ProtoMember(4)]
        public string channel_name;
        [ProtoMember(5)]
        public string version_name;
        [ProtoMember(6)]
        public Dictionary<string, string> map_param;
    }

    //-------------------------------------------------------------------------
    [ProtoContract]
    public class ClientLoginResponse
    {
        [ProtoMember(1)]
        public eLoginResult result;
        [ProtoMember(2)]
        public ulong acc_id;
        [ProtoMember(3)]
        public string token;
        [ProtoMember(4)]
        public string acc;
        [ProtoMember(5)]
        public Dictionary<string, string> map_param;
    }
}
